cmake_minimum_required(VERSION 2.8)

project(rdk_yolo11_seg_v2)

if(NOT DEPS_ROOT)
        set(DEPS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../deps/aarch64)
endif()
message(STATUS "DEPS_ROOT: ${DEPS_ROOT}")

if(NOT RELEASE_ROOT)
        set(RELEASE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../script/)
endif()
message(STATUS "RELEASE_ROOT: ${RELEASE_ROOT}")

set(RELEASE_LIB_DIR ${RELEASE_ROOT}/aarch64/lib/)
set(RELEASE_BIN_DIR ${RELEASE_ROOT}/aarch64/bin/)

include_directories(
        ${HOST_PACKAGE_DIR}/dnn/include
        ${DEPS_ROOT}/glog/include
        ${DEPS_ROOT}/gflags/include
        ${DEPS_ROOT}/opencv/include
        ${CMAKE_SOURCE_DIR}
)


link_directories(
        ${HOST_PACKAGE_DIR}/dnn/lib
        ${DEPS_ROOT}/glog/lib
        ${DEPS_ROOT}/gflags/lib
        ${DEPS_ROOT}/opencv/lib
)


set(SOURCES
    main.cpp  
    detection_bpu.cpp
)

SET(LINK_libs dnn gflags glog opencv_world rt dl pthread dnn)



add_executable(test_yolov8n_seg_v2 ${SOURCES})
target_link_libraries(test_yolov8n_seg_v2 ${LINK_libs})

install(TARGETS test_yolov8n_seg_v2 DESTINATION ${RELEASE_BIN_DIR})

file(COPY ${HOST_PACKAGE_DIR}/dnn/lib/libdnn.so DESTINATION ${RELEASE_LIB_DIR})
#file(COPY ${HOST_PACKAGE_DIR}/dnn_x86/lib/libdnn.so DESTINATION ${RELEASE_LIB_DIR})
file(COPY ${DEPS_ROOT}/opencv/lib/libopencv_world.so.3.4 DESTINATION ${RELEASE_LIB_DIR})

